<template>
	<view class="x-main-content">
		<u-navbar bgColor="#fff" :fixed="true" leftIconColor="#000" leftIconSize="42rpx" autoBack placeholder
			title="系统设置">
		</u-navbar>
		<view style="padding: 40rpx;">
			<view style="background-color: #fff;padding: 20rpx;border-radius: 20rpx;">
				<view class="content-list" @click="goService">
					<view class="">
						服务协议
					</view>
					<img src="../../static/icon/icon_right.png" style="width: 24rpx;height: 24rpx;" />
				</view>
				<view class="content-list" @click="goPolicy">
					<view class="">
						隐私政策
					</view>
					<img src="../../static/icon/icon_right.png" style="width: 24rpx;height: 24rpx;" />
				</view>
				<view class="content-list" @click="goAbout">
					<view class="">
						关于我们
					</view>
					<img src="../../static/icon/icon_right.png" style="width: 24rpx;height: 24rpx;" />
				</view>
				<view class="content-list" @click="goChange" style="position: relative;">
					<view class="">
						切换身份
					</view>
					<view
						style="font-size: 24rpx;color: #4f4f4f;position: absolute;right: 40rpx;top: 20rpx;height: 40rpx;line-height: 40rpx;">
						{{userWindow}}
					</view>
					<img src="../../static/icon/icon_right.png" style="width: 24rpx;height: 24rpx;" />
				</view>
				<view class="content-list">
					<view class="">
						版本号
					</view>
					<view style="color: #ababab;font-size: 24rpx;">
						{{appVersion}}
					</view>
				</view>
			</view>
		</view>
		<view class="toConfirm">
			<view class="btn-confirm" @click="loginOut">
				退出登录
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userWindow: ''
			}
		},
		computed: {
			appVersion() {
				const systemInfo = uni.getSystemInfoSync();
				return systemInfo.appVersion
			}
		},
		onShow() {
			let userWindow = uni.getStorageSync('userWindow')
			if (userWindow == '001') {
				this.userWindow = '普通用户'
			} else if (userWindow == '002') {
				this.userWindow = '陪诊、陪护师'
			} else if (userWindow == '003') {
				this.userWindow = '医生'
			}
		},
		methods: {
			loginOut() {
				uni.showModal({
					title: '提示',
					content: '确定要退出吗？',
					success: res => {
						if (res.confirm) {
							uni.clearStorageSync()
							this.$store.commit('CLEAR_STATE', null)
							uni.navigateTo({
								url: '/pages/loading/index'
							})
						}
						if (res.cancel) {
							return
						}
					}
				})
			},
			goService() {
				uni.navigateTo({
					url: '/pages/login/service'
				})
			},
			goPolicy() {
				uni.navigateTo({
					url: '/pages/login/policy'
				})
			},
			goAbout() {
				uni.navigateTo({
					url: '/pages/mine/about'
				})
			},
			goChange() {
				uni.navigateTo({
					url: '/pages/mine/identity'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content-list {

		padding: 20rpx;
		border-bottom: 1px solid #f4f4f4;
		font-size: 28rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 40rpx;

		.img-right {}

	}

	.toConfirm {
		position: fixed;
		width: 100%;
		bottom: 60rpx;
		left: 0;
		display: flex;
		justify-content: center;

		.btn-confirm {
			padding: 12rpx 0;
			background-color: #386fff;
			font-size: 28rpx;
			color: #fff;
			border-radius: 30rpx;
			letter-spacing: 1px;
			width: 600rpx;
			text-align: center;
		}
	}
</style>